<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>Welcome to the Main Page</h1>
    <button id="myButton">Go to Another Page</button>

    <script>
        window.onload = function() {
            document.getElementById('myButton').onclick = function() {
                window.location.href = 'login.html'; // 页面跳转
            };



            const urlParams = new URLSearchParams(window.location.search);
            console.log(urlParams);
            

            // 获取特定的参数值
            const username = urlParams.get('aaa');
            const userId = urlParams.get('bbb');


            console.log('aaa:', username);  // 输出: admin
            console.log('bbb:', userId);     // 输出: 123
        };
    
    </script>
</body>
</html>